﻿<style type="text/css">
</style>
<div class="mv-edit validate-area" style="margin-top:10px;">
    <div class="cont-top">
        <span>公告类型</span>
        <select id="type" class="validate-elem" validate="true" validate-message="请选择公告类型">
            <option value="1">我要出售</option>
            <option value="2">我要购买</option>
        </select>
    </div>
    <div class="cont-top">
        <span>货币类型</span>
        <select id="coin" class="validate-elem" validate="true" validate-message="请选择货币类型">
            <option :value="coin.id" v-for="coin in bag.coins">
                {{ coin.code }}
            </option>
        </select>
    </div>
    <div class="cont-top">
        <span>价格</span>        
        <input id="price" type="text" class="validate-elem" validate="true" validate-message="请输入价格" placeholder="请输入价格">
    </div>
    <div class="cont-top">
        <span>委托数量</span>
        <input id="amount" type="text" class="validate-elem" validate="true" validate-message="请输入委托数量" placeholder="请输入委托数量">
    </div>
    <div class="cont-top">
        <span>最小限额</span>
        <input id="amount_min" type="text" class="validate-elem" validate="true" validate-message="请输入最小限额" placeholder="请输入最小限额">
    </div>
    <div class="cont-top">
        <span>最大限额</span>
        <input id="amount_max" type="text" class="validate-elem" validate="true" validate-message="请输入最大限额" placeholder="请输入最大限额">
    </div>
    <div class="cont-top">
        <span style="height:45px;">支付方式</span>
        <label><input id="wechat" type="checkbox" class="validate-elem">微信</label>
        <label><input id="alipay" type="checkbox" class="validate-elem">支付宝</label>
        <label><input id="bank" type="checkbox" class="validate-elem">银行</label>
    </div>
    <div class="cont-top">
        <span>备注</span>
        <input id="explain" type="text" class="validate-elem">
    </div>
    <div class="cont-top" v-if="bag.basis.info.issetsafeword == false">
        <span>交易密码</span>
        <input id="safeword" type="password" class="validate-elem" validate="true" validate-message="请输入交易密码" placeholder="请输入交易密码">
    </div>
    <div class="cont-top" style="position: relative;" v-if="bag.basis.info.issetmoblie == false">
        <span>手机验证码</span>
        <input id="smscode" type="text" class="validate-elem" placeholder="请输入验证码" validate="true" validate-message="请输入验证码">
        <input type="text" class="lg-yzm" value="获取验证码" readonly="readonly" v-on:click="send_sms($event)">
    </div>
    <div class="cont-top" style="position: relative;" v-if="bag.basis.info.issetemail == false">
        <span>邮箱验证码</span>
        <input id="mailcode" type="text" class="validate-elem" placeholder="请输入验证码" validate="true" validate-message="请输入验证码">
        <input type="text" class="lg-yzm" value="获取验证码" readonly="readonly" v-on:click="send_mail($event)">
    </div>
</div>
<div style="height:60px;"></div>
<script type="text/javascript">
    var pagedata = {
        request: {
            method: "VIEW_TRANSACTION_BILLADD"
        },
        screen: {
            header_ok_display: true,
            header_display: true,
            header_title_name: "发布公告",
            header_exit_name: "返回",
            header_ok_name: '发布',
            header_exit_click: function () {
                mview.view.back();
            },
            header_ok_click: function () {
                //调用验证表单程序
                mview.view.form.validate("validate-area", function (data) {
                    mview.socket.send({
                        data: {
                            method: "TRANSACTION_ADD",
                            type: data.type,
                            coin: data.coin,
                            price: data.price,
                            amount_min: data.amount_min,
                            amount_max: data.amount_max,
                            amount: data.amount,
                            wechat: String(data.wechat),
                            alipay: String(data.alipay),
                            bank: String(data.bank),
                            explain: data.explain,
                            safeword: data.safeword || "",
                            smscode: data.smscode || "",
                            mailcode: data.mailcode || ""
                        },
                        success: function (data) {
                            if (data.Code == 0) {
                                mview.view.load('/views/Module/Transaction/billlists.html');
                            }
                            else {
                                mview.control.tips(data.Message);
                            }
                        }
                    });
                });
            },
            header_display: true,
            footer_choose: "user"
        },
        data: {

        },
        methods: {
            send_sms: function (event) {
                var elm = event.target;
                mview.custom.sms_only_send(elm);
            },
            send_mail: function (event) {
                var elm = event.target;
                mview.custom.mail_only_send(elm);
            }
        }
    }
    mview.view.chlid.init(pagedata);
</script>